package cn.eaay.stock.controller;

import cn.eaay.stock.service.StockRtInfoService;
import cn.eaay.stock.vo.resp.R;
import cn.eaay.stock.vo.stock.StockWeekRtInfoVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/quot")
public class StockRtInfoController {

    @Resource
    private StockRtInfoService stockRtInfoService;

    /**
     * 模糊查询股票信息
     *
     * @param searchStr
     * @return
     */
    @GetMapping("/stock/search")
    public R<List<Map>> searchStockInfo(String searchStr) {
        return stockRtInfoService.searchStockInfo(searchStr);
    }

    /**
     * 获取周K线
     *
     * @return
     */
    @GetMapping("/stock/screen/weekkline")
    public R<List<StockWeekRtInfoVo>> getWeekKLine(String code) {
        return stockRtInfoService.getStockWeekKLine(code);
    }

    /**
     * 获取个股最新分时行情数据（每分钟数据）
     *
     * @param code
     * @return
     */
    @GetMapping("/stock/screen/second/detail")
    public R<Map> getMinuteStockInfo(String code) {
        return stockRtInfoService.getMinuteStockInfo(code);
    }

    /**
     * 获取个股实时交易流水
     *
     * @return
     */
    @GetMapping("/stock/screen/second")
    public R<List<Map>> getStockTradeInfo(String code) {
        return stockRtInfoService.getStockTradeInfo(code);
    }
}
